{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Mixed variables\n",
    "\n",
    "Mixed variables are those which values contain both numbers and labels.\n",
    "\n",
    "Variables can be mixed for a variety of reasons. For example, when credit agencies gather and store financial information of users, usually, the values of the variables they store are numbers. However, in some cases the credit agencies cannot retrieve information for a certain user for different reasons. What Credit Agencies do in these situations is to code each different reason due to which they failed to retrieve information with a different code or 'label'. Like this, they generate mixed type variables. These variables contain numbers when the value could be retrieved, or labels otherwise.\n",
    "\n",
    "As an example, think of the variable 'number_of_open_accounts'. It can take any number, representing the number of different financial accounts of the borrower. Sometimes, information may not be available for a certain borrower, for a variety of reasons. Each reason will be coded by a different letter, for example: 'A': couldn't identify the person, 'B': no relevant data, 'C': person seems not to have any open account.\n",
    "\n",
    "Another example of mixed type variables, is for example the variable missed_payment_status. This variable indicates, whether a borrower has missed a (any) payment in their financial item. For example, if the borrower has a credit card, this variable indicates whether they missed a monthly payment on it. Therefore, this variable can take values of 0, 1, 2, 3 meaning that the customer has missed 0-3 payments in their account. And it can also take the value D, if the customer defaulted on that account.\n",
    "\n",
    "Typically, once the customer has missed 3 payments, the lender declares the item defaulted (D), that is why this variable takes numerical values 0-3 and then D.\n",
    "\n",
    "\n",
    "For this lecture, you will need to download a toy csv file that I created and uploaded at the end of the lecture in Udemy. It is called sample_s2.csv."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>open_il_24m</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1077501</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1077430</td>\n",
       "      <td>A</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1077175</td>\n",
       "      <td>A</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1076863</td>\n",
       "      <td>A</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1075358</td>\n",
       "      <td>A</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        id open_il_24m\n",
       "0  1077501           C\n",
       "1  1077430           A\n",
       "2  1077175           A\n",
       "3  1076863           A\n",
       "4  1075358           A"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# open_il_24m indicates:\n",
    "# \"Number of installment accounts opened in past 24 months\".\n",
    "# Installment accounts are those that, at the moment of acquiring them,\n",
    "# there is a set period and amount of repayments agreed between the\n",
    "# lender and borrower. An example of this is a car loan, or a student loan.\n",
    "# the borrowers know that they are going to pay a certain,\n",
    "# fixed amount over, for example 36 months.\n",
    "\n",
    "data = pd.read_csv('sample_s2.csv')\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(887379, 2)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['C', 'A', 'B', '0.0', '1.0', '2.0', '4.0', '3.0', '6.0', '5.0',\n",
       "       '9.0', '7.0', '8.0', '13.0', '10.0', '19.0', '11.0', '12.0', '14.0',\n",
       "       '15.0'], dtype=object)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 'A': couldn't identify the person\n",
    "# 'B': no relevant data\n",
    "# 'C': person seems not to have any account open\n",
    "\n",
    "data.open_il_24m.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0xfc894079b0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZsAAAEVCAYAAAA2IkhQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu8VXWd//HXG0HyAgiKpAJiQjVqqcmgpb/SmJCy1Ck1\n7SI6eBud0SabwpoZSqN0Jq1xUkcbyctkSjYpao7itTFHhLwhXkYSFPECAor3BD+/P77fLYvtOWev\nA2eds928n4/Hepy1v2t9v/uz1t5nf/b6ru9eSxGBmZlZlXr1dABmZtb6nGzMzKxyTjZmZlY5Jxsz\nM6uck42ZmVXOycbMzCrnZGNdTtJFkr7fQ88tST+XtFzS3W0s/7KkG3sgrtskHZXnj5B0R3fHYNaT\nnGzWA5IWSFosaZNC2VGSbuvBsKqyF/ApYGhEjKlfGBG/iIhx6/okkkLSyHVtpztJ2lvSUz0dR1fp\nyS811nlONuuPDYCTejqIzpK0QSerbAssiIhXqojHzNaOk83641+Ab0jarH6BpBH5m3rvQll9t8/v\nJf1Y0guSHpf0sVy+MB81TahrdgtJMyS9JOl2SdsW2v5gXrZM0qOSDiksu0jSeZJ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gz8BzCKlGz/KiL+T9Jg4LCIOLsz27FG2042\nZtaMyoyWrLJ+T7eRh8ZvHxEPtsK+cLIxs6Yk6cmIGN5T9VupjWaIwVd9NrMeI+mB9hZRYrTkutZv\npTaaIYaOONmYWU8aQhpmW39uRqST1VXXb6U2miGGdjnZmFlPupb0g9/76hdIuq0b6rdSG80QQ7t8\nzsbMzCrnKwiYmVnlnGzMzKxyTjZmZlY5JxszM6uck42ZmVXu/wNCP2yz4fPUrgAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xfc86ee4908>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Now, let's make a bar plot showing the different number of \n",
    "# borrowers for each of the values of the mixed variable\n",
    "\n",
    "fig = data.open_il_24m.value_counts().plot.bar()\n",
    "fig.set_title('Number of installment accounts open')\n",
    "fig.set_ylabel('Number of borrowers')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "This is how a mixed variable looks like!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "**That is all for this demonstration. I hope you enjoyed the notebook, and see you in the next one.**"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  },
  "toc": {
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "toc_cell": false,
   "toc_position": {
    "height": "550px",
    "left": "0px",
    "right": "869.4px",
    "top": "107px",
    "width": "151px"
   },
   "toc_section_display": "block",
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
